package org.smr.ministore.dao;

import org.apache.ibatis.annotations.Param;
import org.blade.utils.Pager;
import org.smr.ministore.entities.Dictionary;
import org.apache.ibatis.annotations.Mapper;
import org.blade.dao.base.BaseMapper;
import org.blade.dao.base.PageQueryMapper;

import java.util.List;
import java.util.Map;

/**
 *
 **/
@Mapper
public interface DictionaryMapper extends BaseMapper<Long, Dictionary>, PageQueryMapper<Long, Dictionary> {


    /**
     * 获取字典组
     *
     * @param sys       所属系统
     * @param bigType   大类
     * @param organId   组织编号
     * @param organPath 组织路径
     * @return
     */
    List<Dictionary> getDictionaryGroup(@Param("sys") int sys,
                                        @Param("bigType") String bigType,
                                        @Param("organId") Long organId,
                                        @Param("organPath") String organPath);


    /**
     * 获取已经引用字典
     *
     * @param sys
     * @param organId
     * @param bigType
     * @param originId
     * @return
     */
    List<Map<String, Object>> getReferencedDictionaryList(@Param("sys") int sys,
                                                          @Param("organId") Long organId,
                                                          @Param("bigType") String bigType,
                                                          @Param("originId") Long originId);

    /**
     * 获取组织引用的字典
     *
     * @param entity
     * @param pager
     * @return
     */
    List<Dictionary> getOrganReferencedDictionaryPagination(@Param("entity") Dictionary entity,
                                                            @Param("page") Pager<Dictionary> pager);

    /**
     * 查询组织所属字典
     * @param entity
     * @return
     */
    List<Dictionary> getOrganReferencedDictionary(@Param("entity") Dictionary entity);
}
